package com.ruoyi.codebase.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.codebase.domain.CodeBase;
import com.ruoyi.codebase.mapper.CodeBaseMapper;
import com.ruoyi.codebase.service.ICodeBaseService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 码库Service业务层处理
 *
 * @author ruoyi
 * @date 2024-01-14
 */
@Service
public class CodeBaseServiceImpl extends ServiceImpl<CodeBaseMapper,CodeBase> implements ICodeBaseService
{
    @Autowired
    private CodeBaseMapper codeBaseMapper;

    /**
     * 查询码库
     *
     * @param id 码库主键
     * @return 码库
     */
    @Override
    public CodeBase selectCodeBaseById(String id)
    {
        return codeBaseMapper.selectCodeBaseById(id);
    }

    /**
     * 查询码库列表
     *
     * @param codeBase 码库
     * @return 码库
     */
    @Override
    public List<CodeBase> selectCodeBaseList(CodeBase codeBase)
    {
        return codeBaseMapper.selectCodeBaseList(codeBase);
    }

    /**
     * 新增码库
     *
     * @param codeBase 码库
     * @return 结果
     */
    @Override
    public int insertCodeBase(CodeBase codeBase)
    {
        codeBase.setCreateTime(DateUtils.getNowDate());
        return codeBaseMapper.insertCodeBase(codeBase);
    }

    /**
     * 修改码库
     *
     * @param codeBase 码库
     * @return 结果
     */
    @Override
    public int updateCodeBase(CodeBase codeBase)
    {
        return codeBaseMapper.updateCodeBase(codeBase);
    }

    /**
     * 批量删除码库
     *
     * @param ids 需要删除的码库主键
     * @return 结果
     */
    @Override
    public int deleteCodeBaseByIds(String[] ids)
    {
        return codeBaseMapper.deleteCodeBaseByIds(ids);
    }

    /**
     * 删除码库信息
     *
     * @param id 码库主键
     * @return 结果
     */
    @Override
    public int deleteCodeBaseById(String id)
    {
        return codeBaseMapper.deleteCodeBaseById(id);
    }
}
